home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1995-11-28 | 7.0 KB | 258 lines | [ TEXT/MSET]
\ Handles Mops user interface. need alert \ MOPS_OBJECTS sets up system objects for the Mops development environment. \ We put it first so that we can tick the exported versions of some words, \ which have to be referred to by vectors or x-arrays (since a module can \ only be invoked through an exported word). \ Note: the various things we do below in setting up fWind can't be done \ by SysInit, since under System 7 fWind doesn't exist until a dictionary \ is read in, which is later than SysInit time. But for an installed \ application which uses fWind, this module won't exist, so we have a \ separate initialization word AppInit (in file ObjInit) which is called \ by ObjInit for an installed application. fWind will then be available \ from the start, so AppInit does the setting up. : MOPS_OBJECTS { \ left top right bottom -- } ['] (about) -> aboutVec fWind? IF classinit: fWind markalive: fWind ['] enFW ['] disFW setAct: fWind myDoc title: fWind ScreenBits -> bottom -> right -> top -> left 70 70 right bottom true setGrow: fWind setContRect: fWind THEN ; string IMAGENAME \ Current Mops dictionary image name string APPL_NAME \ Default appl name for Install string APPL_VERS \ Ditto version string 0 value APPL_SIG \ Ditto signature \ SAVEBASES marks certain modules as unloaded, but saves their base \ addresses, without actually unloading them. RESTOREBASES restores the \ base addresses the way they were. We do this so a dictionary save can \ be done, yielding a valid dictionary image with the modules marked \ unloaded, but without our needing to reload these modules afterwards. We \ also do this when the "Purge Modules" menu item is chosen. The modules \ we currently treat this way the modules which hang on to vital information \ during a run, so can't be unloaded without entering crash territory. \ If you really want to purge everything, invoke PURGE directly, which \ will even purge this module, probably with entertaining results. \ You have been warned. : SAVEBASES \ ( -- sundry_info ) kludge: FEmod kludge: extrasmod kludge: pathsmod kludge: windowMod kludge: menuMod kludge: TEFwindMod ; : RESTOREBASES \ ( sundry_info -- ) unkludge: TEFwindMod unkludge: menumod unkludge: windowmod unkludge: pathsmod unkludge: extrasmod unkludge: FEmod ; \ =========== Menu handlers =========== 1 alert ABTALRT ' null 1 put: abtAlrt 1 alert NimplAlrt ' null 1 put: NimplAlrt variable VERSION 40 allot : (ABOUT) 50 getString version place 0 0 version count 0 0 0 0 paramText 128 16 disp: abtAlrt ; : xNIMPL 129 cautionAlert disp: NimplAlrt ; \ =============== File Menu =============== 0 value CURRVREF false value SAVED? \ True if dic image saved at least once 0 value SAVE_RC \ I/O return code from dic save : .SAVED type# 101 ( Saved: ) getname: ffcb type cr ; : SAVE \ Takes name from input stream. Redefinition of SAVE in Files, \ adding the call to saveBases and restoreBases, which is \ vital since on Macs with SCSI DMA, PAUSE can get called \ during the write, which will send an IDLE: to our window, \ requiring TEFwindMod to be loaded! setname: ffcb saveBases (save) -> save_rc restoreBases \ Note: (save) does a purge save_rc ?error 105 .saved ; : SAVEDIC get: imageName name: fFcb currVref setVref: fFcb saveBases (save) -> save_rc restoreBases save_rc ?error 105 true -> saved? .saved ; : STDSAVE \ save via stdFile release: callsMod \ this is so big that it's better to reclaim \ its mem before calling Standard File .cur " Save Dictionary As:" saved? IF get: imagename ELSE myDoc THEN stdPut: fFcb IF getVref: fFcb -> currVref getName: fFcb put: imageName saveDic \ get: imageName title: fWind \ ## gone for 2.5! THEN ; : DOSAVE \ Resave current dictionary. saved? IF saveDic ELSE myDoc put: imageName stdSave THEN ; : PSETUP \ page setup nimpl ; \ ============= List Menu =============== : doOlist nimpl ; : doClist nimpl ; \ ============= Show Menu =============== : x.ROOM cr ." Room in dictionary: " room 7 .r cr ." Distance to top of hibase range: " headroom 7 .r cr ." Total heap (no purge): " free 7 .r cr ." Largest block (purge): " freeblk 7 .r cr ; \ ============= Utilities Menu =============== : CHKUTIL \ ( item# b -- ) check item if boolean is true IF check: utilMen ELSE unCheck: utilMen THEN ; \ false value PRECHO? \ 31Jan94 DBH \ : ?UTILFLGS 1 echo? chkUtil 0 prEcho? chkUtil ; : ?UTILFLGS 0 echo? chkUtil ; \ 31Jan94 DBH \ : PECHO \ Toggles echo to printer \ prEcho? not -> prEcho? \ prEcho? IF +print ELSE -print drop: printmod THEN \ ?utilFlgs ; : LECHO \ Toggles echo during loads echo? not -> echo? ?utilFlgs ; : DOPURGE saveBases purge restoreBases ; : DISFW false -> fWindActive? ; : ENFW true -> fWindActive? ; : NMENU lock: menuMod xts{ doUndo null doCut doCopy doPaste doClear doSelAll null doPref } 3 init: EditMen getnew: AppleMen getnew: FileMen getnew: EditMen getnew: ListMen getnew: ShowMen getnew: UtilMen AppleMen FileMen EditMen ListMen ShowMen UtilMen 6 init: MenuBar ?utilFlgs ; \ ============= Edit Menu =============== \ Note: the Edit Menu stuff MUST COME AFTER the definition of Nmenu. This \ is because we must set up the menu with the EXPORTED versions of the \ words doUndo etc. Because we haven't defined these words here in the module \ yet, only the exported versions are visible from Nmenu, which is what we \ want. \ Scrap support string PARMSTR var THEOFFSET handle SCRAPHDL : DoUndo nimpl ; : doCut nimpl ; : doCopy nimpl ; : doClear nimpl ; : doSelAll nimpl ; : xPref nimpl ; : GETSCRAP \ ( -- len ) 0 0 put: parmStr handle: parmStr put: scrapHdl 0 get: scrapHdl 'type TEXT addr: theOffset call GetScrap setSize: parmStr lock: parmStr len: parmStr ; : SCRAPKEY \ Gets next char from the scrap len: parmStr NIF key! unlock: FEmod 13 EXIT THEN \ Simulate a terminal CR 1st: parmStr 1 skip: parmStr ; : DOPASTE \ Interprets from the scrap lock: FEmod getScrap 0<= ?EXIT false -> relocChk? ['] scrapKey -> key true -> relocChk? sp0 sp! quit ; \ The following words are called by Install to get and set the default name, version and signature for the current application. They are initialized to the Mops values, but may be changed at any time. Note that the first two of these words return a string object, rather than an addr and a length. This was simpler for Install, and they shouldn't be getting called from anywhere else. : GET_APPL_NAME appl_name ; : GET_APPL_VERS appl_vers ; : GET_APPL_SIG appl_sig ; : SET_APPL_NAME put: appl_name ; : SET_APPL_VERS put: appl_vers ; : SET_APPL_SIG -> appl_sig ; \ system startup word: : RUN_FE keep: FEmod mops_objects openMR nMenu " mops.paths" getPaths " Mops" put: appl_name 50 getString put: appl_vers 'type MOPS -> appl_sig 20 -> sleepticks run_TE ; : (REL) release: imageName ; ' (rel) setrelease